<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<script type="text/javascript" src="js/jquery-min.js"></script>
	<link rel="stylesheet" type="text/css" href="fontawesome/fontawesome-free-5.10.2-web/css/all.min.css"/>
	<link rel="stylesheet" type="text/css" href="css/missionPlatform.css">
	<script type="text/javascript" src="js/getMissions.js"></script>
	<script type="text/javascript" src="js/acceptMission.js"></script>
	<script type="text/javascript" src="js/Universal%20template.js"></script>
	<title></title>
	<script>
		window.onload=function(){
			function createMission(userName,pubTime,missionName,missionContent,energy,missionId){
				var missions = document.getElementById("missions");
				var missionNew = document.createElement("div");
				var br = document.createElement('br');
				missionNew.className = "missionForm";
				missions.appendChild(missionNew);
				//开始添加form里边的东西
				myAppendChildClass(missionNew,"div","avatar","");
				myAppendChildClass(missionNew,"p","userName",userName);
				myAppendChildClass(missionNew,"p","pubTime",pubTime);
				myAppendChildClass(missionNew,"p","missionMon","悬赏值:<span>"+energy+"</span>");
				myAppendChildClass(missionNew,"p","missionName",missionName);
				myAppendChildClass(missionNew,"p","missionContent",missionContent);
				//var accept=myAppendChildClass(missionNew,"button","accept","接受");
				//var think=myAppendChildClass(missionNew,"button","think","再想想/放弃");
				accept.setAttribute("id",missionId);
			}
			searchforMission();
			var missionList=getCookie("selectResults");
			if(missionList.trim()=="error"){
				return;
			}
			missionList=missionList.replace(/[\r\n]/g,"");
			console.log(missionList);
			missionList=JSON.parse(missionList);
			var recipient;
			for(var i=0;i<missionList.length;i++){
				if(missionList[i].recipient==null||missionList[i].recipient.trim()==""){
					recipient="false";
				}
				else{
					recipient="true";
				}
				createMissionIndex(missionList[i].author,missionList[i].createTime,missionList[i].title,missionList[i].content,missionList[i].reward,"接受者",missionList[i].recipient,"发送者学号:"+missionList[i].userid,recipient,missionList[i].reward,missionList[i].place,missionList[i].id);
				(document.getElementById(missionList[i].id).parentNode).addEventListener("click",missionBind,false);
			}

		}
	</script>
</head>
	<body>
		<div class="navbar">
			<a href="index.html"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
			<p>任务广场</p>
			<i class="fa fa-search" aria-hidden="true"></i>
		</div>
		<div id="missions">
			<div id="elasticFrame">
				<div id="mission">
					<span id="closeBtn">X</span>
				</div>
				<div id="background"></div>
			</div>
		</div>
		<script type="text/javascript" src="js/mission.js"></script>
		<script type="text/javascript" src="js/missionPlatform.js"></script>
	</body>
</html>
